<template>
  <div v-if="baseData" class="base">
    <div class="info-box">
      <p class="title">申请信息</p>
      <van-cell-group>
        <van-field
          v-model="baseData.apply.department"
          label="总公司对口部门"
          label-class="labelColor"
          input-align="right"
          label-width="7em"
          readonly
        />
        <van-field
          v-model="baseData.apply.leader"
          label="总公司对口负责人"
          label-class="labelColor"
          input-align="right"
          label-width="8em"
          readonly
        />
      </van-cell-group>
    </div>
    <div class="info-box">
      <p class="title">基本信息</p>
      <van-cell-group>
        <van-field
          v-model="baseData.basic.subject"
          label="需求名称"
          label-class="labelColor"
          type="textarea"
          input-align="right"
          rows="1"
          autosize
          readonly
        />
        <van-field
          v-model="baseData.basic.number"
          label="需求编号"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.one_category"
          label="需求一级分类"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.two_category"
          label="需求二级分类"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.status"
          label="需求状态"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.hope_date"
          label="期望上线时间"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.urgency"
          label="紧急程度"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.debug_date"
          label="预计联调时间"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.start_date"
          label="预计启动需求时间"
          label-width="8em"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.complete_date"
          label="预计提交验收时间"
          label-width="8em"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.background"
          rows="1"
          autosize
          label-class="labelColor"
          input-align="right"
          label="需求背景"
          type="textarea"
          readonly
        />
        <van-field
          v-model="baseData.basic.describe"
          rows="1"
          autosize
          label-class="labelColor"
          input-align="right"
          label="需求简要描述"
          type="textarea"
          readonly
        />
        <van-field
          v-model="baseData.basic.year_plan"
          label="年度计划内需求"
          label-width="7em"
          label-class="labelColor"
          input-align="right"
          readonly
        />
        <van-field
          v-model="baseData.basic.oa_status"
          label="OA状态"
          label-class="labelColor"
          input-align="right"
          readonly
        />
      </van-cell-group>
    </div>
  </div>
</template>
<script>
import { serviceDetail } from "@/api/service.js";
export default {
  components: {
  },
  props: ["id"],
  data() {
    return {
      baseData: "",
    };
  },
  mounted() {
    if(this.id){
      this.getBase();
    }
  },
  watch:{
    id(){
      this.getBase();
    }
  },
  methods: {
    getBase() {
      let that = this;
      serviceDetail({
        id: that.id,
        node_id:that.currentNode
      }).then((res) => {
        // if(typeof(res.data.details.basic.year_plan) == 'boolean'){
        //   if(!res.data.details.basic.year_plan){
        //     res.data.details.basic.year_plan = ''
        //   }
        // }
        if(res.data.details.basic.year_plan){
          res.data.details.basic.year_plan = '是'
        }else{
          res.data.details.basic.year_plan = '否'
        }
        that.baseData = res.data.details;
      });
    }, 
  },
};
</script>
<style lang="less" scoped>
.base {
  margin-top: 10px;
  .info-box {
    margin-bottom: 10px;
    background: #fff;
    .title {
      height: 53px;
      line-height: 53px;
      color: #011445;
      font-size: 16px;
      font-weight: bold;
      padding: 0 15px;
      margin: 0;
      border-bottom: 1px solid #f2f2f2;
    }
  }
  /deep/.labelColor {
    color: rgba(49, 53, 65, .6);
  }
  /deep/.van-field__control {
    color: #313541;
  }
}
</style>